<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>北京每小时空气质量条形图</title>
    <script src="../static/echarts.min.js"></script>
</head>
<body>
<div id="main" style="width:800px;height:400px"></div>
<script type="text/javascript">
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));

      var timestamp = [{% for item in timestamp %}{{ item }},{% endfor %}];
      var pm = [{% for item in pm %}{{ item }},{% endfor %}];
      var aqi = [{% for item in aqi %}{{ item }},{% endfor %}];

      option = {
      title: {
        text: '北京每小时空气质量条形图'
      },
      tooltip: {
        trigger: 'axis',
        axisPointer: {
          type: 'shadow'
        }
      },
      legend: {},
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },
      xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01]
      },
      yAxis: {
        type: 'category',
        data: timestamp
      },
      series: [
        {
          name: 'PM',
          type: 'bar',
          data: pm
        },
        {
          name: 'AQI',
          type: 'bar',
          data: aqi
        }
      ]
    };

      myChart.setOption(option);



</script>

</body>
</html>